package com.labichaoka.chaoka.entity;

import android.support.annotation.Nullable;

/**
 * Created by ruan on 2018/8/2.
 */

public enum UserInfoInitEnum {
    UNLOGIN("0", "未登入"),
    HASLOGIN("1", "已登入，认证资料未填完"),
    CALCULATE_BALANCE("2", "正在计算专属额度"),
    UN_ACTIVATION("3", "去激活"),//计算完专属额度，未激活
    ACTIVATING("4", "激活中"),
    UNPASS("5", "去激活"), //激活未通过
    PASSED("6", "已激活，未借款"),
    HAS_LOAN("7", "有借款");


    private final String code;
    private final String name;

    UserInfoInitEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    @Nullable
    public static UserInfoInitEnum getUserStatus(String status) {
        for (int i = 0; i < UserInfoInitEnum.values().length; i++) {
            if (UserInfoInitEnum.values()[i].isEquals(status))
                return UserInfoInitEnum.values()[i];
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public String getCode() {
        return code;
    }

    public boolean isEquals(String status) {
        return code.equals(status);
    }
}
